//
//  XGardenNews.swift
//  WeiBoReDo
//
//  Created by 放学跟鸽走 on 2017/4/15.
//  Copyright © 2017年 放学跟鸽走. All rights reserved.
//

import UIKit
/// 图文样式：1：代表一个配图 2：代表3个配图 3：大图
///
/// - Normal: 代表左边一个配图
/// - ThreePic: 代表3个配
/// - BigPic:大图
enum XGardenNewsCellType:Int {
    case Normal = 1
    case ThreePic = 2
    case BigPic = 3
}

/// 园地模型
class XGardenNews: NSObject {

    ///标题
    var title:String?//\u5510\u5C71\u5E02\u56DB\u5173\u9E3D\u738B\u9996\u517314866\u7FBD\u7ADE\u8D5B",
    /// 链接，原文链接
    var link:String?{
        didSet{
            guard let link = link else {
                return
            }
            self.link = "http://m.chinaxinge.com/androidapk/"+link.xx_href()
//            print(self.link)
        }
    }//newsview.asp?id=0&amp;newsid=136505",
    
    /// 配图
    var img:String?//http:\/\/pic5.chinaxinge.com\/news\/photo\/upload2\/jd\/201704\/20170415080332.jpg",
    /// 作者
    var author:String?//\u6C99\u6F20\u738B\u4E2D\u738B",
    /// 发布时间
    var dtime:String?//2017-4-15",
    /// 鸽闻ID
    var newsid:Int64 = 0//136505
    /// 图文样式：1：代表一个配图 2：代表3个配图 3：大图
    var app_flag:Int = 1{
        didSet{
            if app_flag>1{
                cellType = (app_flag == 2) ? .ThreePic : .BigPic
            }
        }
    }
    var cellType:XGardenNewsCellType = .Normal
    /// 暂时未用到
    /// 赞
    var likenum:Int = 2
    /// 评论数
    var plnum:Int = 1
    lazy var imgList:[String] = [String](repeating: "http://pic5.chinaxinge.com/news/photo/upload2/jd/201704/20170415080332.jpg", count: 3)
    /// 图片一
    var img1:String?{//http:\/\/gdgs.chinaxinge.com\/pic2\/201704\/20170415072731741_s.jpg",
        didSet{
            guard let img1 = img1 else {
                return
            }
            imgList[0] = img1
        }
    }
    /// 图片二
    var img2:String?{//http:\/\/gdgs.chinaxinge.com\/pic2\/201704\/20170415072731741_s.jpg",
        didSet{
            guard let img2 = img2 else {
                return
            }
            
            imgList[1] = img2
            
        }
    }
    /// 图片三
    var img3:String?{//http:\/\/gdgs.chinaxinge.com\/pic2\/201704\/20170415072731741_s.jpg",
        didSet{
            guard let img3 = img3 else {
                return
            }
            imgList[2] = img3
        }
    }
    
    var f:Int = 0
    /// 暂时未用到
    var url:String?//",
    /// 暂时未用到
    var nid:String?//",
    /// 暂时未用到
    var gs_f:Int = 1
    /// 暂时未用到
    var bk_f:Int = 1
    
    /// 暂时未用到
    var app_flag1:Int = 0
    /// 暂时未用到
    var app_linkopen:Int = 0
    /// 暂时未用到
    var app_linkapi:String?//: null,
    /// 暂时未用到
    var app_linkparam:String?//:null,
    /// 暂时未用到
    var ds_audit:Int = 1
    /// 暂时未用到
    var news_flag:Int = 0
    
    override var description: String{
        return self.yy_modelDescription()
    }
}
